﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="Microsoft.SharePoint.Linq, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ListColumnPermissions.aspx.cs"
    Inherits="SharePointListSecurity.Layouts.SharePointListSecurity.ListColumnPermissions"
    DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <SharePoint:CssRegistration Name="SharepointListSecurity/Style.css" runat="server" />
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <script type="text/javascript">
        function confirmdelete() {
            return confirm('<asp:Literal ID="Literal1" runat="server" Text="<%$Resources:ListSecurityResource,DeleteAllAlert%>" />');
        }
        function confirmviewpermission() {
            return confirm('<asp:Literal ID="Literal123" runat="server" Text="<%$Resources:ListSecurityResource,SaveViewPermissionAlert%>" />');
        }

    </script>
    <table style="width: 100%; height: 100%" class="ms-settingsframe ms-listedit" border="0" cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <td width="100%">
                    <table cellspacing="3" cellpadding="0" width="100%">
                        <tbody>
                            <tr height="10">
                                <td style="padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px"
                                    id="TD1" class="ms-linksectionheader" colspan="4">
                                    <h3 class="ms-standardheader">
                                        <asp:Literal runat="server" Text="<%$Resources:ListSecurityResource,ColumnPermissions%>" /></h3>
                                </td>
                            </tr>
                            <tr>
                                <td id="TD2" class="ms-descriptiontext ms-listedit-sectiondescription" valign="top"
                                    colspan="4">
                                    <asp:Literal runat="server" Text="<%$Resources:ListSecurityResource,ListColumnPermissionDescription%>" />
                                </td>
                            </tr>
                            <tr>
                                <td class="ms-gb" colspan="4">
                                    <table border="0" cellspacing="0" summary="Tasks" cellpadding="0" width="100%">
                                        <tbody class="columnPermissions">
                                            <tr>
                                                <th id="1600" class="ms-vh2-nofilter" width="25%" scope="col">
                                                    <asp:Literal runat="server" Text="<%$Resources:ListSecurityResource,ColumnClick%>" />
                                                </th>
                                                <th id="Th3" class="ms-vh2-nofilter" width="25%" scope="col">
                                                    <asp:Literal runat="server" Text="<%$Resources:ListSecurityResource,ViewForm%>" />
                                                </th>
                                                <th id="Th4" class="ms-vh2-nofilter" width="25%" scope="col">
                                                    <asp:Literal runat="server" Text="<%$Resources:ListSecurityResource,EditForm%>" />
                                                </th>
                                                <th id="1700" class="ms-vh2-nofilter" width="25%" scope="col">
                                                    <asp:Literal runat="server" Text="<%$Resources:ListSecurityResource,AddForm%>" />
                                                </th>
                                            </tr>
                                            <%
                                                string rowClass = "ms-alternating";
                                                SharePointListSecurity.Model.FieldPermissionInfo p;
                                                for (int i = 0; i < fieldsPermissions.Count; i++)
                                                {
                                                    p = fieldsPermissions[i];
                                                    rowClass = (rowClass == "") ? "ms-alternating" : "";
                                            %>
                                            <tr class="<%=rowClass%>">
                                                <td class="ms-vb2">
                                                    <a id="" href="EditListColumnPermissions.aspx?List={<%=spList.ID%>}&Field={<%=p.Field.Id%>}">
                                                        <%=p.Field.Title%></a>
                                                </td>
                                                <td class="ms-vb2">
                                                    <table>
                                                        <colgroup>
                                                            <col style="width: 80px;" />
                                                            <col />
                                                        </colgroup>
                                                        <tr>
                                                            <td style="vertical-align: top;">
                                                                <% RenderDisplayPermissionFlag(p.DisplayFormPermissions); %>
                                                            </td>
                                                            <td>
                                                                <%RenderDisplayUsers(p.DisplayFormPermissions);%>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td class="ms-vb2">
                                                    <%if (p.EditFormPermissions != null && !string.IsNullOrEmpty(p.EditFormPermissions.Permission))
                                                      { %>
                                                    <table>
                                                        <colgroup>
                                                            <col style="width: 80px;" />
                                                            <col />
                                                        </colgroup>
                                                        <tr>
                                                            <td style="vertical-align: top;">
                                                                <% RenderEditPermissionFlag(p.EditFormPermissions); %>
                                                            </td>
                                                            <td>
                                                                <%RenderEditUsers(p.EditFormPermissions);%>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <% } %>
                                                    <% if (p.EditFormPermissions != null && !string.IsNullOrEmpty(p.EditFormPermissions.Permission) && !string.IsNullOrEmpty(p.EditFormPermissions.DisplayMode))
                                                       {%>
                                                    <br />
                                                    <% } %>
                                                    <%if (p.EditFormPermissions != null && !string.IsNullOrEmpty(p.EditFormPermissions.DisplayMode))
                                                      { %>
                                                    <table>
                                                        <colgroup>
                                                            <col style="width: 80px;" />
                                                            <col />
                                                        </colgroup>
                                                        <tr>
                                                            <td style="vertical-align: top;">
                                                                <% RenderEditDisplayModeFlag(p.EditFormPermissions); %>
                                                            </td>
                                                            <td>
                                                                <%RenderEditDisplayModeUsers(p.EditFormPermissions);%>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    <%} %>
                                                    <%if (p.EditFormPermissions == null)
                                                      { %>
                                                    <table>
                                                        <colgroup>
                                                            <col style="width: 80px;" />
                                                            <col />
                                                        </colgroup>
                                                        <tr>
                                                            <td style="vertical-align: top;">
                                                                <span class="flag notSet">
                                                                    <asp:Literal runat="server" Text="<%$Resources:ListSecurityResource,NotSet%>" /></span>
                                                            </td>
                                                            <td></td>
                                                        </tr>
                                                    </table>
                                                    <%} %>
                                                </td>
                                                <td class="ms-vb2">
                                                    <table>
                                                        <colgroup>
                                                            <col style="width: 80px;" />
                                                            <col />
                                                        </colgroup>
                                                        <tr>
                                                            <td style="vertical-align: top;">
                                                                <% RenderAddPermissionFlag(p.AddFormPermissions); %>
                                                            </td>
                                                            <td>
                                                                <%RenderAddUsers(p.AddFormPermissions);%>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <%
                                                }
                                            %>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <table cellspacing="0" cellpadding="0" width="100%">
                        <colgroup>
                            <col width="99%">
                            <col width="1%">
                        </colgroup>
                        <tbody>
                            <tr>
                                <td>Allow only default view
                                    <asp:CheckBox ID="ViewPermission_CheckBox"  runat="server" />
                                </td>
                                <td>
                                    <asp:Button CssClass="ms-ButtonHeightWidth" OnClick="SaveViewPermissions_Click" AccessKey="O" ID="SaveViewPermissions" OnClientClick="return confirmviewpermission();" runat="server" Text="Save views Permissions" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <table cellspacing="0" cellpadding="0" width="100%">
                        <colgroup>
                            <col width="99%">
                            <col width="1%">
                        </colgroup>
                        <tbody>
                            <tr>
                                <td>&nbsp;
                                </td>
                                <td nowrap>
                                    <asp:Button CssClass="ms-ButtonHeightWidth" OnClick="DeltePermissions_Click" AccessKey="O" OnClientClick="return confirmdelete();" ID="DeltePermissions" runat="server" Text="<%$Resources:ListSecurityResource,DeletePermissions%>" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr height="60">
                <td>&nbsp;
                </td>
            </tr>
        </tbody>
    </table>
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    <%=spList.Title%>
    -
    <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:ListSecurityResource,ColumnPermissions%>" />
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
    <a id="onetidListHlink" href="<%SPHttpUtility.AddQuote(SPHttpUtility.UrlPathEncode(spList.DefaultViewUrl, true), Response.Output);%>"><%SPHttpUtility.HtmlEncode(spList.Title, Response.Output);%></a>&#32;<SharePoint:ClusteredDirectionalSeparatorArrow ID="ClusteredDirectionalSeparatorArrow1" runat="server" />
    <a href='<%SPHttpUtility.AddQuote(SPHttpUtility.UrlPathEncode(this.Web.Url + "/_layouts/listedit.aspx?List=" + spList.ID.ToString(), true), Response.Output);%>'>
        <SharePoint:FormattedStringWithListType ID="FormattedStringWithListType1" runat="server" String="<%$Resources:wss,listsettings_titleintitlearea%>" LowerCase="false" />
    </a>&#32;<SharePoint:ClusteredDirectionalSeparatorArrow ID="ClusteredDirectionalSeparatorArrow2" runat="server" />
    <asp:Literal ID="Literal3" runat="server" Text="<%$Resources:ListSecurityResource,ColumnPermissions%>" />
</asp:Content>
